#include <iostream>
#include <vector>
using namespace std;

int main() {
    string g;
    cin >> g;
    bool flag = true;
    vector<char> h;
    for (int i = 0; i < g.size(); i++) {
        if (g[i] == '(' or g[i] == '[' or g[i] == '{' or g[i] == '<') {
            h.push_back(g[i]);
        }
        else if (g[i] == ')' or g[i] == ']' or g[i] == '}' or g[i] == '>') {
            if (h.empty()) {
                flag = false;
                break;
            }
            else if (g[i] - h.back() == 1 or g[i] - h.back() == 2) {
                h.pop_back();
            }
            else {
                flag = false;
                break;
            }
        }
    }

    if (flag and h.empty()) {
        cout << "Yes";
    } else {
        cout << "No";
    }

    return 0;
}
